#include "SubsystemNewTerrain.h"
#include "SubsystemDisguiseBehavior.h"

#include "Terrain/TerrainContentsGenerator23.h"

#include "Blocks/GraniteBlock.h"   // 花岗岩，伪装煤矿，铜矿
#include "Blocks/BasaltBlock.h"    // 玄武岩，伪装其它矿物
#include "Blocks/SandstoneBlock.h" // 砂岩，伪装硝石


namespace AntiMineralTrace
{
    void SubsystemNewTerrain::load(const nlohmann::json &json)
    {
        SubsystemTerrain::load(json);

        // 煤矿
        for (auto &brush : TerrainContentsGenerator23::coalBrushes)
        {
            for(auto &tbCell : brush.cellsMap)
            {
                tbCell.second.value = Terrain::MakeBlockValue(GraniteBlock::Index(), 0, SubsystemDisguiseBehavior::SetSpecail(0, Granite_CoalOreBlock));
            }
        }

        // 铜矿
        for (auto &brush : TerrainContentsGenerator23::copperBrushes)
        {
            for(auto &tbCell : brush.cellsMap)
            {
                tbCell.second.value = Terrain::MakeBlockValue(GraniteBlock::Index(), 0, SubsystemDisguiseBehavior::SetSpecail(0, Granite_CopperOreBlock));
            }
        }



        // 硝石矿
        for (auto &brush : TerrainContentsGenerator23::saltpeterBrushes)
        {
            for(auto &tbCell : brush.cellsMap)
            {
                tbCell.second.value = Terrain::MakeBlockValue(SandstoneBlock::Index(), 0, SubsystemDisguiseBehavior::SetSpecail(0, Sandstone_SaltpeterOreBlock));
            }
        }



        // 铁矿
        for (auto &brush : TerrainContentsGenerator23::ironBrushes)
        {
            for(auto &tbCell : brush.cellsMap)
            {
                tbCell.second.value = Terrain::MakeBlockValue(BasaltBlock::Index(), 0, SubsystemDisguiseBehavior::SetSpecail(0, Basalt_IronOreBlock));
            }
        }

        // 硫磺矿
        for (auto &brush : TerrainContentsGenerator23::sulphurBrushes)
        {
            for(auto &tbCell : brush.cellsMap)
            {
                tbCell.second.value = Terrain::MakeBlockValue(BasaltBlock::Index(), 0, SubsystemDisguiseBehavior::SetSpecail(0, Basalt_SulphurOreBlock));
            }
        }

        // 钻石矿
        for (auto &brush : TerrainContentsGenerator23::diamondBrushes)
        {
            for(auto &tbCell : brush.cellsMap)
            {
                tbCell.second.value = Terrain::MakeBlockValue(BasaltBlock::Index(), 0, SubsystemDisguiseBehavior::SetSpecail(0, Basalt_DiamondOreBlock));
            }
        }

        // 锗石矿
        for (auto &brush : TerrainContentsGenerator23::germaniumBrushes)
        {
            for(auto &tbCell : brush.cellsMap)
            {
                tbCell.second.value = Terrain::MakeBlockValue(BasaltBlock::Index(), 0, SubsystemDisguiseBehavior::SetSpecail(0, Basalt_GermaniumOreBlock));
            }
        }

    }
}
